/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dtomapper;

import java.util.HashMap;
import java.util.Map;
import org.apache.commons.lang.StringUtils;

/**
 *
 * @author f4733401, Mlungisi Sincuba<mlungisi.sincuba@fnb.co.za>
 */
public class ClassProperties {
    private String simpleName;
    private String name;
    private Map<String, String> propertyMap = new HashMap<>();

    public String capitaliseAndSplit(String property) {
        property = StringUtils.capitalize(property);
        char[] toCharArray = property.toCharArray();
        String content = "";
        for (char c : toCharArray) {
            if (c != toCharArray[0] && Character.isUpperCase(c)){
                content += " " + c;
            } else {
                content += c;
            }
        }
        return content;
    }
    
    public String getSimpleName() {
        
        return simpleName;
    }

    public void setSimpleName(String simpleName) {
        this.simpleName = capitaliseAndSplit(simpleName);
    }

    /**
     * @return the propertyMap
     */
    public Map<String, String> getPropertyMap() {
        return propertyMap;
    }

    /**
     * @param propertyMap the propertyMap to set
     */
    public void setPropertyMap(Map<String, String> propertyMap) {
        this.propertyMap = propertyMap;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = StringUtils.uncapitalize(name);
    }

    @Override
    public String toString() {
        return "ClassProperties{" + "simpleName=" + simpleName + ", name=" + name + ", propertyMap=" + propertyMap + '}';
    }
    
}
